﻿@using PagedList.Mvc
@model PagedList.IPagedList<Tippelde.Services.Dtos.TeamHeaderData>
@{
    ViewBag.Title = "Csapatok";
}
<div class="row">
    <div class="col-md-6">
        <h2>Csapatok</h2>
        <p>
            <a href='@Url.Action("Create", "Team")' class="btn btn-link" data-remote="@Url.Action("Create", "Team", new { partial=true })"
               data-toggle="modal" data-target="#teamModal">
                <span class="glyphicon glyphicon-plus-sign"></span> Új csapat hozzáadása
            </a>
        </p>
        <table class="table table-striped table-hover table-teams">
            <tbody>
                @foreach (var t in Model)
                {
                    <tr>
                        <td class="team-logo"><img src="@t.LogoUrl" alt="@t.ShortName" /></td>
                        <td>@t.Name</td>
                        <td>@t.ShortName</td>
                        <td>@(t.IsNational ? "Nemzeti" : "")</td>
                        <td>
                            <a href='@Url.Action("Edit","Team", new { Id = @t.Id})' class="" data-remote="@Url.Action("Edit", "Team", new { Id = t.Id, partial=true })"
                               data-toggle="modal" data-target="#teamModal">
                                <span class="glyphicon glyphicon-edit" title="Szerkesztés"></span>
                            </a>
                            <a href='@Url.Action("Delete","Team", new { Id = @t.Id})' class="">
                                <span class="glyphicon glyphicon-remove" title="Törlés"></span>
                            </a>
                        </td>
                    </tr>
                }
            </tbody>
            <thead>
                <tr><th colspan="3">Csapat</th><th>Típus</th><th>Opciók</th></tr>
            </thead>
        </table>
        <div class="pull-right">
            @Html.PagedListPager(Model, page => Url.Action("Index", "Team", new { page = page }),
    PagedListRenderOptions.OnlyShowFivePagesAtATime)
        </div>
        <div id="teamModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modalTitle" aria-hidden="true">

        </div>
    </div>
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script>
        $(document).ready(function () {
            $('.modal').on('hidden.bs.modal', function () {
                $(this).removeData();
            })
        });
    </script>
}